{% extends "h:templates/layouts/admin.html.jinja2" %}

{% set page_id = 'nipsa' %}
{% set page_title = '"Not in public site areas"' %}

{% block content %}
  <p>
    On this page you can apply (and remove) the "not in public site areas" flag
    from users. Flagging a user as NIPSA means that while they will continue to see
    all their annotations as normal, their annotations will not show up in the
    public stream or in default public searches.
  </p>

  <div class="panel panel-default">
    <div class="panel-heading">
      <h3 class="panel-title">Flag a user</h3>
    </div>
    <div class="panel-body">
      <form method="POST" class="form-inline">
        <input type="hidden" name="csrf_token" value="{{ get_csrf_token() }}">
        <div class="form-group">
          <label for="add">Username</label>
          <input type="text" class="form-control" name="add">
        </div>
        <div class="form-group">
          <label for="authority">Authority</label>
          <input type="text" class="form-control" name="authority" value="{{ default_authority }}">
          <input type="submit" class="btn btn-default" value="Add">
        </div>
      </form>
    </div>
  </div>

  <div class="panel panel-default">
    <div class="panel-heading">
      <h3 class="panel-title">Unflag a user</h3>
    </div>
    <div class="panel-body">
      {% if userids %}
      <form
        method="POST"
        action="{{ request.route_url('admin.nipsa') }}">
        <input type="hidden" name="csrf_token" value="{{ get_csrf_token() }}">
        <ul>
          {% for userid in userids %}
            <li>
              {{ userid }}
              <button type="submit" class="btn btn-link btn-sm"
                      name="remove" value="{{ userid }}">
                Remove
              </button>
            </li>
          {% endfor %}
        </ul>
      </form>
      {% else %}
        <p><em>No users are currently flagged&hellip;</em></p>
      {% endif %}
    </div>
  </div>
{% endblock %}
